{extend name="platform/base" /} {block name="resources"/}
{/block} {block name="main"}
<div class="row padder-v">
	<div class="col-sm-7"></div>
	<div class="col-sm-2">
		<div class="input-group">
			<input id="userName" class="input-sm form-control" type="text"
				value="" placeholder="请输入用户名">

		</div>
	</div>

	<div class="col-sm-2">
		<div class="input-group">
			<input id="userTel" class="input-sm form-control" type="text"
				value="" placeholder="请输入手机号">
		</div>
	</div>
	<div class="col-sm-1">
		<div class="input-group">
			<span class="input-group-btn">
				<button class="btn btn-sm btn-default" type="button"
					onclick="LoadingInfo(1)">搜索</button>
			</span>
		</div>
	</div>
</div>
<section class="panel panel-default">
	<div class="table-responsive">
		<table class="table table-striped b-light text-sm">
			<colgroup>
				<col style="width: 3%;">
				<col style="width: 9%;">
				<col style="width: 10%;">
				<col style="width: 10%;">
				<col style="width: 10%;">
				<col style="width: 10%;">
				<col style="width: 10%;">
				<col style="width: 10%;">
				<col style="width: 9%;">
				<col style="width: 9%;">
				<col style="width: 10%;">
			</colgroup>
			<thead>
				<tr>
					<th class="center"><label> <input type="checkbox"></label></th>
					<th class="left">推广员</th>
					<th class="left">手机号</th>
					<th class="left">提现流水号</th>
					<th class="left">提现银行</th>
					<th class="left">提现账户</th>
					<th class="left">账户姓名</th>
					<th class="right">提现金额</th>
					<th class="center">提现日期</th>
					<th class="center">状态</th>
					<th class="center">操作</th>
				</tr>
			</thead>
			<tbody id="list">
				<tr></tr>
			</tbody>
		</table>
	</div>
	{include file="platform/page" /}
</section>
{/block} {block name="script"}
<script type="text/javascript">	
	$(function(){
		LoadingInfo(1);
	});
	//加载数据
	function LoadingInfo(pageIndex) {
		var user_name = $.trim($("#userName").val());
		var user_phone = $.trim($("#userTel").val());
		$.ajax({
			type : "post",
			url : "{:__URL('PLATFORM_MAIN/Commission/userCommissionWithdrawList')}",
			async : true,
			data : {
				"pageIndex" : pageIndex,
				"user_name":user_name,
				"user_phone":user_phone
			},
			success : function(data) {
				var html = '';
				$("#total_count_num").text(data["total_count"]);
				$("#page_count_num").text(data["page_count"]);
				$("#page_count").val(data["page_count"]);
				$("#pageNumber a").remove();
				if (data["data"].length > 0) {
					for (var i = 0; i < data["data"].length; i++) {
						var status = "";
						var lock_operrate = "";
						var lock_do = 1;
						if(data["data"][i]["status"] == 0){
							status = "审核中";
						}else if(data["data"][i]["status"] == 1){
							status = "已通过";							
						}else{
							status = "已拒绝";	
						}
						html += '<tr align="center">';
						html += '<td><div class="cell"><label ><input name="sub" type="checkbox" value="'+ data["data"][i]["id"] +'" ></label></div></td>';
						html += '<td align="left">' + data["data"][i]["real_name"] + '</td>';
						html += '<td align="left">' + data["data"][i]["mobile"] + '</td>';
						html += '<td align="left">' + data["data"][i]["withdraw_no"] + '</td>';
						html += '<td align="left">' + data["data"][i]["bank_name"] + '</td>';
						html += '<td align="right">' + data["data"][i]["account_number"] + '</td>';
						html += '<td align="left">' + data["data"][i]["realname"] + '</td>';
						html += '<td align="right">' + data["data"][i]["cash"] + '</td>';
						html += '<td align="center">' + timeStampTurnTime(data["data"][i]["ask_for_date"]) + '</td>';
						//html += '<td>' + data["data"][i]["payment_date"] + '</td>';
						html += '<td align="center">' + status + '</td>';
						html += '<td align="center">';
						//html += '<a  href="javascript:void(0);" onclick="partnerAudit('+ data["data"][i]["partner_id"] +')">修改上级</a>';
						if(data["data"][i]["status"] == 0){
							html += '<a  href="javascript:void(0);" onclick="audit('+ data["data"][i]["id"] +', 1);">通过</a>';
							html += '&nbsp;&nbsp;<a  href="javascript:void(0);" onclick="audit('+ data["data"][i]["id"] +', -1);">拒绝</a>';
						}
						html += '</td> ';
						html += '</tr>';
					}
				} else {
					html += '<tr><td colspan="11" align="center">暂无符合条件的数据记录</td></tr>';
				}
				
				$("#list").html(html);
				var totalpage = $("#page_count").val();
				if (totalpage == 1) {
					changeClass("all");
				}
		var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
		$("#pageNumber").append($html);
			}
		});
	}	
	//全选
	function CheckAll(event){
		var checked = event.checked;
		$(".style0list tbody input[type = 'checkbox']").prop("checked",checked);
	}
	//推广员审核通过
	function partnerAudit(id){
		$( "#dialog" ).dialog({				
            buttons: {
                "确定,#e57373": function() {
                	audit(id,1);
                    $(this).dialog('close');
                },
                "拒绝": function() {
                	audit(id,-1);
                    $(this).dialog('close');
                }
            },
            contentText:"确定要通过此用户的股东审核吗？",
		});
	}
	function audit(id,status){
		$.ajax({
			type : "post",
			url : "{:__URL('PLATFORM_MAIN/Commission/userCommissionWithdrawAudit')}",
			async : true,
			data : {
				"id" : id,
				"status":status
			},
			success : function(data) {	
				console.log(data);
				
				if (data["code"] > 0) {
					showMessage('success', data["message"],"{:__URL('PLATFORM_MAIN/Commission/userCommissionWithdrawList')}");
				}else{
					showMessage('error', data["message"]);
				}					
			}
    	})
	}
</script>
{/block}
